<?php
namespace Home\Controller;
use Think\Controller;
class AuthController extends Controller {
	public function __construct(){
		parent::__construct();
		//dump(session('home_user'));
		$navs = M('nav')->where('n_status = 1')->select();
		foreach($navs as $key=>$val){
			$control = explode('/',$val['n_url']);
			$navs[$key]['control'] = ucfirst(strtolower($control[0]));
		}
		$ban = M('banner')->select();
		//dump($navs);
		$this->assign('list' , $ban);
		$this->assign('navs' , $navs);
		$this->assign('session',session('home_user'));
        $this->assign('list',M('banner')->select());
	}
	
	public function login_if(){
		if(empty($_SESSION['home_user'])){
				echo "<script>alert('请登录');location.href='".U('login/index')."';</script>";
		}
	}

    public function bootstrap_page_style($page_html){
        if ($page_html) {
            $page_show = str_replace('<div>','<nav><ul class="pagination">',$page_html);
            $page_show = str_replace('</div>','</ul></nav>',$page_show);

            $page_show = str_replace('<span class="current">','<li class="active"><a>',$page_show);
            $page_show = str_replace('</span>','</a></li>',$page_show);

            $page_show = str_replace(array('<a class="num"','<a class="prev"','<a class="next"','<a class="end"','<a class="first"'),'<li><a',$page_show);
            $page_show = str_replace('</a>','</a></li>',$page_show);
        }
        return $page_show;
    }

	
}